﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebUI.Models;
using WebUI.Utils;
using Utils;

namespace WebUI.Attribute
{
    public class AdminAuthorizeAttribute : AuthorizeAttribute
    {
        protected override Boolean AuthorizeCore(HttpContextBase httpContext)
        {
            //check if admin, if not, return false
            Boolean authorized = base.AuthorizeCore(httpContext);
            return authorized && ViewModelUtils.IsAdmin();
        }
    }
}